﻿using Castle.DynamicProxy;
using Microsoft.Extensions.Logging;

namespace Wenyu.Framework.AutofacAOP.AOPExtend
{
    public class CustomLogInterceptor : IInterceptor  //nuget:Castle.Core
    {
        private readonly ILogger<CustomLogInterceptor> _logger;

        public CustomLogInterceptor(ILogger<CustomLogInterceptor> logger)
        {
            this._logger = logger;
        }
        public void Intercept(IInvocation invocation)
        {
            _logger.LogInformation($"===================={invocation.Method.Name}执行前=================");
            invocation.Proceed();//继续往后执行
            _logger.LogInformation($"===================={invocation.Method.Name}执行后=================");

        }
    }
}
